import React,{Component} from 'react';

import {
	Text,
	View,
	Animated,
	LayoutAnimation,
	BackAndroid,
	TouchableWithoutFeedback,
	Easing,
	Dimensions,
	Image,
	StyleSheet
} from 'react-native';
import {
	scaleSize,
	setSpText
} from './util';

import timeago from 'timeago.js';
var timeagoInstance = timeago();

export default class NewsItemHeader extends Component{
	render(){
		var {
			logo,
			post_time,
			post_tag,
			nickname
		} = this.props;
		return (
			<View style={styles.rowItemHeader}>
				<Image source={{uri:logo}} style={styles.avatar}/>
				<View style={styles.authorText}>
					<Text style={styles.author}>
						{nickname}
					</Text>
					<Text style={{justifyContent:'center',alignItems:"center"}}>
						<Text style={styles.post_time}>{timeagoInstance.format(post_time,"zh_CN") } · {post_tag}</Text>
					</Text>
				</View>
				<View style={{width:70,justifyContent:'center',alignItems:'center'}}>
					<Text style={{color:"#2a90d7"}}>+关注</Text>
				</View>
			</View>				
			)
	}
}


const styles=StyleSheet.create({
	rowItemHeader:{
		height:70,
		flexDirection:'row',
		paddingVertical:13,
		paddingBottom:0,
		paddingHorizontal:13,
		paddingTop:0,
		alignItems:'center'
	},
	avatar:{
		width:scaleSize(100),
		height:scaleSize(100),
		borderRadius:scaleSize(50),
		overflow:"hidden"
	},
	authorText:{
		flex:1,
		marginLeft:12,
		marginTop:6


	},
	author:{
		fontWeight:"bold",
		marginBottom:5
	},
	post_time:{
		color:"#9e9e9e",
		fontSize:12
	},
	post_tag:{

	},
})